Version Note: mean curve using “Wave” function to analyze periodic sin wave variance on the selected nodes

1. Function Implementations

1.1 function 1: ReadFile and attach packages

1.2. function 2: Wave

1.3. function 3: fourier_smooth

1.4. function 4: fPCA.nodes

1.5. function 5: node.scaler

1.6. function 6: row.check

1.7 function pc.df

it’s to put variance on 1st and 2nd Principle Components into dataframe. It is the same.

main script

1. Parkinson Disease - Placebo Group

pd_placebo <- c(1,4,6,10,14,15,18,20,22,23,31,46,47,50,56,60,61,64,65,80,81,91,97)
for (i in pd_placebo){
  df_tmp = ReadFile(paste('/Users/hanwang/desktop/Git_desktop/Functional_Data_Analysis/Data for Zach/Data for Zach ', i,'.csv', sep=""),
                    time_subset=c(1:600), node_subset=c(1,2,3,8,11,31))
  tmp=pc.df(df_tmp)
  a = as.matrix(tmp$mean)
  #a$index = c(1:80)
  d <- melt(data = a, id.vars = c("index"), measure.vars = colnames(df_tmp))
  print(ggplot(d, aes(x = Var1, y = value)) + 
          geom_line(aes(color = Var2))+ggtitle(paste("PD, patient", i)))
}

2. Healthy Control - Placebo Group

hc_placebo <- c(11,25,29,33,38,40,41,43,51,58,67,70,71,73,86,90,94,96,100)
for (i in hc_placebo){
  df_tmp = ReadFile(paste('/Users/hanwang/desktop/Git_desktop/Functional_Data_Analysis/Data for Zach/Data for Zach ', i,'.csv', sep=""),
                    time_subset=c(1:600), node_subset=c(1,2,3,8,11,31))
  tmp=pc.df(df_tmp)
  a = as.matrix(tmp$mean)
  #a$index = c(1:80)
  d <- melt(data = a, id.vars = c("index"), measure.vars = colnames(df_tmp))
  print(ggplot(d, aes(x = Var1, y = value)) + 
          geom_line(aes(color = Var2))+ggtitle(paste("HC, patient", i)))
}